<%--
  - Author		:	Jaewon Choi
  - Date			:
  - Description	:	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});

			function validation(){
				<c:if test="${param.fAct eq 'view'}">
					return true;
				</c:if>
				try{
					with(document.frm){
						
						if(appId.value.replace(/\s/g, '') == ""){
							alert("[APP ID]는 필수 입력 항목입니다.");
							id.focus();
							return false;
						}
					}
				}catch(err){
					return false;	
				}
				
				return confirm(confirmMsg);
			}
			var confirmMsgs = ["등록 하시겠습니까?", "수정 하시겠습니까?", "삭제 하시겠습니까?"];
			var confirmMsg = "";
		</script>
	</head>
	<body>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="menuTitle">
					이용자
					<c:choose>
						<c:when test="${param.fAct eq 'view'}">상세보기</c:when>
						<c:when test="${not empty app}">수정</c:when>
						<c:otherwise>등록</c:otherwise>
					</c:choose>
				</div>
				<form id="frm" name="frm" method="post" action="<c:url value="/app/submit.do" />" onsubmit="return validation();">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchAppId" value="${param.searchAppId}" />
					<input type="hidden" name="idx" value="${app.idx}">
					<table class="frmTbl" border="0">
						<colgroup>
							<col width="176px;" />
							<col width="*" />
						</colgroup>
						<tbody>
							<tr>
								<th>APP ID</th>
								<td>
									<c:choose>
										<c:when test="${param.fAct eq 'view'}">
											${app.appId}
										</c:when>
										<c:otherwise>
											<input type="text" name="appId" value="${app.appId}" maxlength="100" title="APP ID입니다." />
										</c:otherwise>
									</c:choose>
								</td>
							</tr>
						</tbody>
					</table>
					<c:choose>
						<c:when test="${empty app}">
							<input type="button" class="btn" value="취소" onclick="javascript:document.listFrm.submit();" />
							<input type="submit" class="btn" value="등록" onclick="javasciprt:confirmMsg=confirmMsgs[0];"/>
						</c:when>
						<c:when test="${param.fAct eq 'view'}">
							<input type="button" class="btn" value="목록" onclick="javascript:document.listFrm.submit();" />
							<input type="submit" class="btn" value="수정" onclick="javasciprt:document.frm.action='<c:url value="/app/form.do" />';" />
						</c:when>
						<c:otherwise>
							<input type="button" class="btn" value="취소" onclick="javascript:document.listFrm.submit();" />
							<input type="submit" class="btn" value="수정" onclick="javasciprt:confirmMsg=confirmMsgs[1];"/>
							<input type="button" class="btn" value="삭제" onclick="javascript:if(confirm(confirmMsgs[2])){document.removeFrm.submit();}" />
						</c:otherwise>
					</c:choose>
				</form>
				<form name="listFrm" action="<c:url value="/app/list.do" />" method="post" style="display: none;">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="appId" value="${param.searchAppId}" />
				</form>
				
				<form name="removeFrm" action="<c:url value="/app/remove.do" />" method="post" style="display: none;">
					<input type="hidden" name="fAct" value="remove">
					<input type="hidden" name="idx" value="${app.idx}">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchAppId" value="${param.searchAppId}" />
				</form>
			</div>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
		</div>
	</body>
</html> 